package com.ruoyi.function.utility;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@ConfigurationProperties(prefix = "aliyun.ocr")
public class AliyunConfig {
    private static final Logger log = LoggerFactory.getLogger(AliyunConfig.class);
    
    private String accessKeyId;
    private String accessKeySecret;
    private String regionId = "cn-beijing";

    // getter and setter
    public String getAccessKeyId() {
        return accessKeyId;
    }

    public void setAccessKeyId(String accessKeyId) {
        this.accessKeyId = accessKeyId;
    }

    public String getAccessKeySecret() {
        return accessKeySecret;
    }

    public void setAccessKeySecret(String accessKeySecret) {
        this.accessKeySecret = accessKeySecret;
    }

    public String getRegionId() {
        return regionId;
    }

    public void setRegionId(String regionId) {
        this.regionId = regionId;
    }

    @PostConstruct
    public void init() {
        // 在bean初始化后检查配置
        log.info("阿里云OCR配置初始化 - AccessKeyId: {}, Region: {}", 
            accessKeyId != null ? accessKeyId.substring(0, 4) + "****" : "null", 
            regionId);
    }
} 